.386
.model flat, stdcall
option casemap :none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib
.stack 200
.data
__error_resta db "RESULTADO NEGATIVO EN RESTA", 0
__error_overflow db "OVERFLOW EN PRODUCTO", 0
__error_division db "ERROR EN DIVISION", 0
__error db "ERROR", 0
_9ui dw 9
_BIEN db "BIEN", 0
_1ui dw 1
_10ui dw 10
_g dd ?
_f dd ?
_2ui dw 2
_e dd ?
_d dw ?
_c dw ?
_b dw ?
_a dw ?
_MAL db "MAL", 0
_3ui dw 3
_13ul dd 13
.code
start:
MOV bx, _10ui
MOV _a, bx
MOV bx, _2ui
MOV _b, bx
MOV bx, _1ui
MOV _c, bx
MOV bx, _3ui
MOV _d, bx
MOV ebx, 0
MOV bx, _2ui
MOV _e, ebx
MOV ebx, 0
MOV bx, _a
SUB ebx, _e
JS res_negativo
MOV eax, 0
MOV ax, _c
ADD ebx, eax
MOV _f, ebx
MOV ebx, 0
MOV bx, _9ui
MOV eax, _f
CMP eax, ebx
JNE @Label31
invoke MessageBox, NULL, addr _BIEN, addr _BIEN, MB_OK
JMP @Label33
@Label31:
invoke MessageBox, NULL, addr _MAL, addr _MAL, MB_OK
@Label33:
MOV ebx, 0
MOV bx, _a
ADD ebx, _f
MOV eax, 0
MOV ax, _b
SUB ebx, eax
JS res_negativo
SUB ebx, _e
JS res_negativo
MOV eax, 0
MOV ax, _2ui
SUB ebx, eax
JS res_negativo
MOV _g, ebx
MOV ebx, _g
CMP ebx, _13ul
JNE @Label53
invoke MessageBox, NULL, addr _BIEN, addr _BIEN, MB_OK
JMP @Label55
@Label53:
invoke MessageBox, NULL, addr _MAL, addr _MAL, MB_OK
@Label55:
jmp fin
overflow:
invoke MessageBox, NULL, addr __error_overflow, addr __error, MB_OK
invoke ExitProcess, 0
res_negativo:
invoke MessageBox, NULL, addr __error_resta, addr __error, MB_OK
invoke ExitProcess, 0
division:
invoke MessageBox, NULL, addr __error_division, addr __error, MB_OK
invoke ExitProcess, 0
fin:
invoke ExitProcess, 0
end start